[1] "Age Distribution of Positive Patients in India"
[1] "Age Distribution of Negative Patients in India"
Min. 1st Qu. Median Mean 3rd Qu. Max.
0.00 23.00 32.00 34.73 45.00 100.00
[1] "Gender wise Distribution of Positive & Negative Patients in India(%)"
Negative Positive
F 36.65537 36.90307
M 63.34463 63.09693
[1] "State wise Distribution of Positive & Negative Patients(%)"
Negative Positive
ANDAMAN AND NICOBAR ISLANDS 0.121892720 0.019059317
ANDHRA PRADESH 10.989532576 3.030431376
ARUNACHAL PRADESH 0.070085789 0.016941615
ASSAM 1.006347106 0.186357765
BIHAR 4.830264135 0.798373605
CHANDIGARH 0.103714850 0.243535715
CHHATTISGARH 0.786596850 0.108002795
DADRA AND NAGAR HAVELI 0.059885984 0.002117702
DAMAN AND DIU 0.023934196 0.002117702
DELHI 7.138752695 6.056627348
GOA 0.232878718 0.042354037
GUJARAT 5.633826997 15.175451600
HARYANA 2.917952162 0.929671121
HIMACHAL PRADESH 0.306802058 0.046589441
JAMMU AND KASHMIR 1.926147352 0.620486648
JHARKHAND 1.169543988 0.097414286
KARNATAKA 7.507864454 1.158382923
KERALA 7.958978606 15.209334830
LADAKH 0.122902602 0.031765528
LAKSHADWEEP 0.023530243 0.000000000
MADHYA PRADESH 3.756759896 2.825014294
MAHARASHTRA 13.874259630 31.653289850
MANIPUR 0.138858733 0.069884162
MEGHALAYA 0.074125316 0.033883230
MIZORAM 0.021611468 0.019059317
NAGALAND 0.024338149 0.016941615
ODISHA 2.677398343 0.440481989
PUDUCHERRY 0.149664467 0.072001864
PUNJAB 1.265078796 1.109675780
RAJASTHAN 4.575369995 3.489972682
SIKKIM 0.004544468 0.000000000
TAMIL NADU 9.722736981 8.932466487
TELANGANA 1.694682468 1.751339446
TRIPURA 0.147644703 0.010588509
UTTAR PRADESH 6.573117959 2.977488829
UTTARAKHAND 0.764682417 0.370597827
WEST BENGAL 1.603692127 2.452298765
[1] "State wise Distribution of patients based on Final Test Patients(%)"
Antigen Negative Antigen Positive Negative
ANDAMAN AND NICOBAR ISLANDS 0.000000000 0.000000000 0.138817806
ANDHRA PRADESH 0.135020532 0.173761946 9.219365486
ARUNACHAL PRADESH 0.112703089 0.434404865 0.067856260
ASSAM 4.814988395 0.608166811 0.649694934
BIHAR 27.390198179 0.086880973 2.653179756
CHANDIGARH 0.033476165 0.000000000 0.114665578
CHHATTISGARH 1.066773790 0.000000000 0.780807029
DADRA AND NAGAR HAVELI 0.000000000 0.000000000 0.068201292
DAMAN AND DIU 0.000000000 0.000000000 0.027257515
DELHI 0.562399572 0.434404865 8.070179474
GOA 0.431842528 0.000000000 0.074066833
GUJARAT 0.306864846 0.000000000 6.384353957
HARYANA 0.232101410 0.000000000 3.297699213
HIMACHAL PRADESH 0.102660239 0.000000000 0.338821256
JAMMU AND KASHMIR 5.871719336 0.781928758 1.588181510
JHARKHAND 3.853106588 0.347523892 0.932045981
KARNATAKA 1.372522764 0.260642919 8.369092049
KERALA 11.829360828 89.574283232 7.844183626
LADAKH 0.011158722 0.000000000 0.138817806
LAKSHADWEEP 0.051330120 0.000000000 0.021506984
MADHYA PRADESH 0.790037493 0.000000000 4.195587043
MAHARASHTRA 17.976700589 2.258905300 13.943771313
MANIPUR 0.289010891 0.781928758 0.128351840
MEGHALAYA 0.022317443 0.086880973 0.082117575
MIZORAM 0.190814140 0.695047785 0.004945456
NAGALAND 0.035707909 0.000000000 0.024037217
ODISHA 10.864131405 0.608166811 1.924127501
PUDUCHERRY 0.035707909 2.085143354 0.166765384
PUNJAB 0.523344046 0.086880973 1.383692646
RAJASTHAN 0.085922157 0.000000000 5.201239814
SIKKIM 0.000000000 0.000000000 0.004025371
TAMIL NADU 0.013390466 0.000000000 11.057695072
TELANGANA 2.082217461 0.000000000 1.714808191
TRIPURA 0.706347081 0.173761946 0.094998764
UTTAR PRADESH 5.812578111 0.086880973 6.873494080
UTTARAKHAND 0.715274058 0.000000000 0.797023525
WEST BENGAL 1.678271737 0.434404865 1.624524862
Positive TrueNAT Screening Negative
ANDAMAN AND NICOBAR ISLANDS 0.019642078 0.000000000
ANDHRA PRADESH 2.706241816 91.720768786
ARUNACHAL PRADESH 0.006547359 0.009641962
ASSAM 0.176778699 0.003213987
BIHAR 0.814054998 0.691007264
CHANDIGARH 0.250982104 0.000000000
CHHATTISGARH 0.111305107 0.141415440
DADRA AND NAGAR HAVELI 0.002182453 0.000000000
DAMAN AND DIU 0.002182453 0.000000000
DELHI 6.230903536 0.051423796
GOA 0.019642078 4.097833773
GUJARAT 15.639458752 0.003213987
HARYANA 0.958096901 0.041781835
HIMACHAL PRADESH 0.048013968 0.000000000
JAMMU AND KASHMIR 0.619816674 0.006427975
JHARKHAND 0.091663029 0.077135695
KARNATAKA 1.158882584 1.112039596
KERALA 13.424268878 0.019283924
LADAKH 0.032736796 0.000000000
LAKSHADWEEP 0.000000000 0.000000000
MADHYA PRADESH 2.907027499 0.038567847
MAHARASHTRA 32.509821039 0.115703542
MANIPUR 0.052378874 0.000000000
MEGHALAYA 0.032736796 0.000000000
MIZORAM 0.002182453 0.000000000
NAGALAND 0.017459625 0.000000000
ODISHA 0.436490615 0.147843415
PUDUCHERRY 0.021824531 0.000000000
PUNJAB 1.141422959 0.086777656
RAJASTHAN 3.596682671 0.016069936
SIKKIM 0.000000000 0.032139873
TAMIL NADU 9.203404627 0.382464485
TELANGANA 1.804888695 0.016069936
TRIPURA 0.006547359 0.009641962
UTTAR PRADESH 3.055434308 0.369608536
UTTARAKHAND 0.381929289 0.003213987
WEST BENGAL 2.516368398 0.806710805
TrueNAT Screening Positive
ANDAMAN AND NICOBAR ISLANDS 0.000000000
ANDHRA PRADESH 75.600000000
ARUNACHAL PRADESH 0.000000000
ASSAM 0.000000000
BIHAR 1.200000000
CHANDIGARH 0.000000000
CHHATTISGARH 0.000000000
DADRA AND NAGAR HAVELI 0.000000000
DAMAN AND DIU 0.000000000
DELHI 0.000000000
GOA 4.400000000
GUJARAT 0.000000000
HARYANA 0.000000000
HIMACHAL PRADESH 0.000000000
JAMMU AND KASHMIR 0.000000000
JHARKHAND 0.000000000
KARNATAKA 5.200000000
KERALA 0.000000000
LADAKH 0.000000000
LAKSHADWEEP 0.000000000
MADHYA PRADESH 0.800000000
MAHARASHTRA 10.000000000
MANIPUR 0.000000000
MEGHALAYA 0.000000000
MIZORAM 0.000000000
NAGALAND 0.000000000
ODISHA 0.400000000
PUDUCHERRY 0.000000000
PUNJAB 0.000000000
RAJASTHAN 0.000000000
SIKKIM 0.000000000
TAMIL NADU 0.400000000
TELANGANA 0.000000000
TRIPURA 0.000000000
UTTAR PRADESH 2.000000000
UTTARAKHAND 0.000000000
WEST BENGAL 0.000000000
| Variable | N | Mean | Std. Dev. | Min | Pctl. 25 | Pctl. 50 | Pctl. 75 | Max |
|---|---|---|---|---|---|---|---|---|
| age | 1037436 | 35 | 17 | 0 | 23 | 32 | 45 | 100 |
---
title: "Covid-19 Dashboard"
output:
flexdashboard::flex_dashboard:
orientation: row
vertical_layout: fill
theme: simplex
social: ["menu"]
source_code: embed
#Runtime: shiny
#runtime: shiny
---
```{r global, include=FALSE}
library(flexdashboard)
library(tidyverse)
library(plotly)
library(DT)
library(fontawesome)
library(shiny)
library(knitr) # for kable
library(kableExtra)
data = read_csv("D:/Covid-19 Dashboard/ICMR CSV converted data.csv")
#Deleting observations having India as state
data = data[-which(data$district_residence == "INDIA"),]
#deleting other genders only M and F
data = data[-which(is.na(data$gender) == T),]
data = data[-which(data$gender == "T" | data$gender == "O"),]
# Age only in years
data$age_in[data$age_in == "year" | data$age_in == "Year"] = "Years"
data$age_in[data$age_in == "month"] = "Months"
data$age[data$age_in == "Months"] = data$age[data$age_in == "Months"]/12
data$age[data$age_in == "Days"] = data$age[data$age_in == "Days"]/365
# Age only less than 100 years
data = data[-which(data$age > 100),]
#Unique State District
u_s_d = data %>% distinct(state_residence,district_residence)
# Final Test result
data = data %>% mutate(final_test_result = coalesce(final_test_result,orf1b_confirmatory))
data = data %>% mutate(final_test_result = coalesce(final_test_result,rdrp_confirmatory))
data = data %>% mutate(final_test_result = coalesce(final_test_result,egene_screening))
data = data[-which(is.na(data$final_test_result)==T),]
values_to_replace = c("Sample Rejected","ANTIGEN Negative","ANTIGEN Positive","Inconclusive")
replacement_values = c("Sample Rejected", "Antigen Negative", "Antigen Positive", "Inconclusive/Invalid Result")
data <- data %>% mutate(final_test_result = ifelse(final_test_result %in% values_to_replace,
replacement_values[match(final_test_result, values_to_replace)],
final_test_result))
data <- data %>% mutate(final_status = case_when(
final_test_result == "Negative" ~ "Negative",
final_test_result == "TrueNAT Screening Negative" ~ "Negative",
final_test_result == "Antigen Negative" ~ "Negative",
final_test_result == "Positive" ~ "Positive",
final_test_result == "Antigen Positive" ~ "Positive",
final_test_result == "TrueNAT Screening Positive" ~ "Positive",
final_test_result == "Spillage" ~ "Others",
final_test_result == "Under Process" ~ "Others",
final_test_result == "Inconclusive/Invalid Result" ~ "Others",
final_test_result =="Sample Rejected" ~ "Others"))
data = data[-which(data$final_status == "Others"),]
# Creating table
t_pos = data[data$final_status == "Positive",]
t_neg = data[data$final_status == "Negative",]
t1 = data %>% group_by(gender,state_residence,final_test_result,final_status) %>% summarise(Freq = n())
```
# Overview
# Input {.sidebar data-width="250"}
#Covid-19 Dashboard
```{r}
selectizeInput("state",
label = h3("State"),
choices = sort(u_s_d$state_residence),
multiple = F,
selected = NULL,
options = list(
placeholder = 'Select a State',
search = TRUE))
selectizeInput("district", label = h3("District"), choices = NULL, selected = NULL)
renderText({ c_state = input$state
d_state = sort(u_s_d$district_residence[u_s_d$state_residence == c_state])
updateSelectizeInput(session, "district",
choices = d_state ,
selected = NULL)
})
selectizeInput("gender", label = h3("Gender"),
choices = c("M","F"),)
actionButton("run_qa1", " Run Gender Wise")
selectizeInput("final_test",
label = h3("Final Test Result"),
choices = sort(unique(data$final_test_result)),
multiple = F,
selected = NULL)
actionButton("run_qa2", "Run Final Test Result")
selectizeInput("status",
label = h3("Final Status"),
choices = c("Positive", "Negative"),
multiple = F,
selected = NULL)
actionButton("run_qa3", "Run Final Status")
```
Column
------------------------
# All India
Row
---------------------------
```{r}
ggplotly(ggplot(data, aes(x =final_status , y = age, fill = gender)) +
geom_boxplot() +
labs(title = "Box Plots of Age Distribution",
x = "Final Status",
y = "Age (Years)",
fill = "Gender") +
theme_minimal())
```
```{r}
ggplotly(ggplot(t1, aes(x =final_status , y = Freq, fill = gender)) +
geom_boxplot() +
labs(title = "Bar Plots of Gender Distribution",
x = "Final Status",
y = "No. of Patients",
fill = "Gender") +
theme_minimal())
```
```{r}
ggplotly(ggplot(t1, aes(x =final_test_result , y = Freq, fill = gender)) +
geom_boxplot() +
labs(title = "Bar Plots of Gender Distribution",
x = "Final Test Result",
y = "No. of Patients",
fill = "Gender") +
theme_minimal())
ggplotly(ggplot(t1, aes(x =final_status , y = Freq, fill = state_residence)) +
geom_boxplot() +
labs(title = "Bar Plots of State Distribution",
x = "Final Status",
y = "No. of Patients",
fill = "State") +
theme_minimal())
#print("Pie chart showing Gender wise Distribution of Positive Patients in India(%)")
#ggplotly(pie(prop.table(table(t_pos$gender))*100))
#print("Pie chart showing Gender wise Distribution of Negative Patients in India(%)")
#ggplotly(pie(prop.table(table(t_neg$gender))*100))
```
# Visualizations {data-icon="fa-signal"}
```{r}
g <- ggplot(data, aes(gender))
g + geom_bar()
ggplotly(g)
#pie(table(gender))
#pie(table(region))
#pie(table(egene_screening))
# Shiny input for a slider
#sliderInput("bins", "Number of bins:", min = 1, max = 50, value = 30)
# Use the slider input in your visualization
#renderPlot({
# hist(rnorm(input$bins), col = 'lightblue', border = 'black')
#})
```
## Column {data-width="350"}
```{r}
```
```{r}
```
# Tables {data-icon="fa-table"}
Row
---------------------------
### Age Distribution of Positive Patients in India
```{r}
print("Age Distribution of Positive Patients in India")
tww = summary(t_pos$age)
```
### Age Distribution of Negative Patients in India
```{r}
print("Age Distribution of Negative Patients in India")
summary(t_neg$age)
print("Gender wise Distribution of Positive & Negative Patients in India(%)")
prop.table(table(data$gender,data$final_status),margin = 2)*100
print("State wise Distribution of Positive & Negative Patients(%)")
prop.table(table(data$state_residence,data$final_status),margin = 2)*100
print("State wise Distribution of patients based on Final Test Patients(%)")
prop.table(table(data$state_residence,data$final_test_result),margin = 2)*100
```
# Data
```{r}
#data %>% datatable(extensions = "Buttons",
#options = list(dom="Blfrtip",
# button=c("copy", "csv", "excel", "pdf",
# "print")))
library(vtable)
# return will return the data as data.frame but look at other options as well
kable(sumtable(data[,3], out = "return",add.median = T))
```